package com.qjc.demo.observer.service.impl;

import com.qjc.demo.observer.event.MessageVO;
import com.qjc.demo.observer.event.ObserverEvent;
import com.qjc.demo.observer.service.ISendMessageService;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;

/**
 * 文件描述
 *
 * @ClassName: SendSmsServiceImpl
 * @Author: qjc
 * @Date: 2023/5/10 16:00
 */
@Service
public class SendEmailServiceImpl implements ISendMessageService {
    @Override
    @EventListener
    public void sendMessage(ObserverEvent observerEvent) {
        MessageVO messageVO = (MessageVO) observerEvent.getSource();
        System.out.println("使用注解方式-给" + messageVO.getSendTo() + "发送邮件，内容为：" + messageVO.getContent());
    }
}
